package com.tianji.learning.controller;

import com.tianji.api.client.remark.RemarkClient;
import com.tianji.api.dto.remark.LikeRecordFormDTO;
import com.tianji.learning.domain.dto.MyLikeDTO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 19311
 * @CreateTime: 2025-03-26
 * @Description: 点赞接口
 * @Version: 1.0
 */
@RestController
@Slf4j
@RequestMapping("/likes")
@RequiredArgsConstructor
public class LikesController {

    private final RemarkClient remarkClient;

    @PostMapping
    public void addLike(@RequestBody MyLikeDTO myLikeDTO) {
        LikeRecordFormDTO likeRecordFormDTO = new LikeRecordFormDTO();
        likeRecordFormDTO.setBizId(myLikeDTO.getId());
        likeRecordFormDTO.setBizType("QA");
        likeRecordFormDTO.setLiked(myLikeDTO.getLiked());
        remarkClient.addLike(likeRecordFormDTO);
    }

}
